import request from '@/network'

// 发布留言
export const createWordRequest = async (content: string) => {
  const result = await request.post({
    url: '/word/create_word',
    data: {
      content,
      comment_id: null,
    },
  })
  return result
}
// 获得全部留言
export const queryWordListRequest = async (currentPage: number = 1, pageSize: number = 7) => {
  const result = await request.get({
    url: '/word/list',
    params: {
      currentPage,
      pageSize,
    },
  })
  return result
}
// 获得未审核的留言
export const queryUnExamineRequest = async (currentPage: number = 1, pageSize: number = 7) => {
  const result = await request.get({
    url: '/word/un_examine_list',
    params: {
      currentPage,
      pageSize,
    },
  })
  return result
}
// 获得审核通过的留言
export const queryExamineRequest = async (currentPage: number = 1, pageSize: number = 7) => {
  const result = await request.get({
    url: '/word/examine_list',
    params: {
      currentPage,
      pageSize,
    },
  })
  return result
}
// 获得审核不通过的留言
export const queryFailExamineRequest = async (currentPage: number = 1, pageSize: number = 7) => {
  const result = await request.get({
    url: '/word/fail_examine_list',
    params: {
      currentPage,
      pageSize,
    },
  })
  return result
}
// 删除留言 根据id
export const deleteWordRequest = async (word_id: number) => {
  const result = await request.delete({
    url: '/word/delete_word',
    data: {
      word_id,
    },
  })
  return result
}
// 审核留言-通过
export const examineSuccessWordRequest = async (word_id: number) => {
  const result = await request.patch({
    url: '/word/examine_success',
    data: {
      word_id,
    },
  })
  return result
}
// 审核留言-不通过
export const examineFailWordRequest = async (word_id: number) => {
  const result = await request.patch({
    url: '/word/examine_fail',
    data: {
      word_id,
    },
  })
  return result
}
